package com.locker.modules.sys.license;

import java.io.Serializable;
import java.util.List;

/**
 * 自定义需要校验的License参数
 *
 * @author zifangsky
 * @date 2018/4/23
 * @since 1.0.0
 */
public class LicenseCheckModel implements Serializable{

    private static final long serialVersionUID = 8600137500316662317L;
    /**
     * 可被允许的IP地址
     */
    private List<String> ipAddress;

    //允许接入设备数量
    private int deviceNum;

    //允许创建账户数量
    private int userNum;

    //允许接入员工数量
    private int memberMaxNum;

    //允许接入访客数量
    private int visitorMaxNum;

    /**
     * 可被允许的MAC地址
     */
    private List<String> macAddress;

    /**
     * 可被允许的CPU序列号
     */
    private String cpuSerial;

    /**
     * 可被允许的主板序列号
     */
    private String mainBoardSerial;

    public List<String> getIpAddress() {
        return ipAddress;
    }

    public void setIpAddress(List<String> ipAddress) {
        this.ipAddress = ipAddress;
    }

    public int getDeviceNum() {
        return deviceNum;
    }

    public void setDeviceNum(int deviceNum) {
        this.deviceNum = deviceNum;
    }

    public int getUserNum() {
        return userNum;
    }

    public void setUserNum(int userNum) {
        this.userNum = userNum;
    }

    public int getMemberMaxNum() {
        return memberMaxNum;
    }

    public void setMemberMaxNum(int memberMaxNum) {
        this.memberMaxNum = memberMaxNum;
    }

    public int getVisitorMaxNum() {
        return visitorMaxNum;
    }

    public void setVisitorMaxNum(int visitorMaxNum) {
        this.visitorMaxNum = visitorMaxNum;
    }

    public List<String> getMacAddress() {
        return macAddress;
    }

    public void setMacAddress(List<String> macAddress) {
        this.macAddress = macAddress;
    }

    public String getCpuSerial() {
        return cpuSerial;
    }

    public void setCpuSerial(String cpuSerial) {
        this.cpuSerial = cpuSerial;
    }

    public String getMainBoardSerial() {
        return mainBoardSerial;
    }

    public void setMainBoardSerial(String mainBoardSerial) {
        this.mainBoardSerial = mainBoardSerial;
    }

//    private JSONObject
    @Override
    public String toString() {
        StringBuilder sb1 = new StringBuilder();
        StringBuilder sb2 = new StringBuilder();
        for (int i = 0; i < ipAddress.size(); i++) {
            if(ipAddress.size()>1){
                if(i==0) {
                    sb1.append("[\"").append(ipAddress.get(i)).append("\"");
                }else if(i==ipAddress.size()-1) {
                    sb1.append(",\"").append(ipAddress.get(i)).append("\"]");
                }else {
                    sb1.append(",\"").append(ipAddress.get(i)).append("\"");
                }
            }else {
                sb1.append("[\"").append(ipAddress.get(i)).append("\"]");
            }
        }
        for (int i = 0; i < macAddress.size(); i++) {
            if(macAddress.size()>1){
                if(i==0) {
                    sb2.append("[\"").append(macAddress.get(i)).append("\"");
                }else if(i==macAddress.size()-1) {
                    sb2.append(",\"").append(macAddress.get(i)).append("\"]");
                }else {
                    sb2.append(",\"").append(macAddress.get(i)).append("\"");
                }
            }else {
                sb2.append("[\"").append(macAddress.get(i)).append("\"]");
            }
        }
        return  "{\"ipAddress\":" + sb1 +
                ",\"macAddress\":" + sb2 +
                ",\"cpuSerial\":\"" + cpuSerial + "\"" +
                ",\"mainBoardSerial\":\"" + mainBoardSerial + "\"}";
    }




//
//    @Override
//    public String toString() {
//        return "LicenseCheckModel{" +
//                "ipAddress=" + ipAddress +
//                ", macAddress=" + macAddress +
//                ", cpuSerial='" + cpuSerial + '\'' +
//                ", mainBoardSerial='" + mainBoardSerial + '\'' +
//                '}';
//    }
}
